package view;

import service.AdminService;
import service.StudentManagerService;

import java.util.Scanner;

//控制台界面
public class ConsoleView {
    StudentManagerService studentManagerService = new StudentManagerService();
    public void loginView(){
        //用来保存键盘输入的
        String adminUsername;
        String adminPassword;
        Boolean isLogin;
        AdminService adminService = new AdminService();
        Scanner scanner = new Scanner(System.in);
        System.out.println("管理员账号：");
        adminUsername = scanner.nextLine();
        System.out.println("管理员密码：");
        adminPassword = scanner.nextLine();
        isLogin = adminService.login(adminUsername, adminPassword);
        if (isLogin) {
            System.out.println("登录成功");
        }else{
            System.out.println("登陆失败");
            System.out.println("请重新输入");
            loginView();
        }
        menuView();
    }
    //操作菜单界面
    public void menuView(){
        System.out.println("-----------------");
        System.out.println("1.新增学生信息");
        System.out.println("2.删除学生信息");
        System.out.println("3.修改学生信息");
        System.out.println("4.查询学生信息");
        System.out.println("5.退出");
        System.out.println("-----------------");
        int num = studentManagerService.selectMenuNum();
        System.out.println("用户选择了"+num);
    }
}
